package org.hugh.controller;

import org.hugh.model.QuotationInfoEntity;
import org.hugh.quotation.QuotationService;
import org.hugh.quotation.QuotationSync;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class QuotationController {

    @Autowired
    private QuotationSync quotationSync;
    @Autowired
    private QuotationService quotationService;

    @RequestMapping("refresh")
    String refresh(){
        quotationSync.syncQuotation();
        return "SUCCESS";
    }

    @RequestMapping("query")
    QuotationInfoEntity query(@RequestParam("secCode") String secCode){
        return quotationService.querySingleSec(secCode);
    }

}
